export const setCookie = (name, value, day) => {
    var exp = new Date();
    exp.setTime(exp.getTime() + (day || 1)*24*60*60*1000);
    document.cookie = name + "=" + encodeURIComponent(value)
        + ";expires=" + exp.toGMTString()
        + ";path=/"
};

export const getCookie = (name) => {
    var arr,
        reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    arr = document.cookie.match(reg);
    if (arr) {
        return decodeURIComponent(arr[2]);
    } else {
        return null;
    }
};